﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using Microsoft.Phone.Shell;
using System.Windows.Media.Imaging;

namespace MiniChat
{
    public partial class MiniChat : PhoneApplicationPage
    {
        public MiniChat()
        {
            InitializeComponent();
            
        }

    //    TimePicker tpk = new TimePicker();

    //    private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
    //    {
    //        ApplicationBar = new ApplicationBar();

    //        ApplicationBar.Mode = ApplicationBarMode.Default;
    //        ApplicationBar.Opacity = 1.0;
    //        ApplicationBar.IsVisible = true;
    //        ApplicationBar.IsMenuEnabled = true;

    //        if (pvMiniChat.SelectedItem == pvListContact)
    //        {
    //            ApplicationBarIconButton cmdAdd = new ApplicationBarIconButton();
    //            cmdAdd.IconUri = new Uri("Images/add.png", UriKind.Relative);
    //            cmdAdd.Text = "Add Contact";
    //            ApplicationBar.Buttons.Add(cmdAdd);

    //            ApplicationBarIconButton cmdSearch = new ApplicationBarIconButton();
    //            cmdSearch.IconUri = new Uri("Images/search.png", UriKind.Relative);
    //            cmdSearch.Text = "Search Contact";
    //            ApplicationBar.Buttons.Add(cmdSearch);
    //            cmdsearch.Click += new RoutedEventHandler(cmdsearch_Click);
    //        }
    //        else
    //        {
    //            ApplicationBarIconButton cmdSent = new ApplicationBarIconButton();
    //            cmdSent.IconUri = new Uri("Images/check.png", UriKind.Relative);
    //            cmdSent.Text = "Sent";
    //            ApplicationBar.Buttons.Add(cmdSent);
    //            cmdSent.Click += new EventHandler(cmdSent_Click);

    //            ApplicationBarIconButton cmdMail = new ApplicationBarIconButton();
    //            cmdMail.IconUri = new Uri("Images/mail.png", UriKind.Relative);
    //            cmdMail.Text = "Mail";
    //            ApplicationBar.Buttons.Add(cmdMail);
    //            cmdMail.Click += new EventHandler(cmdMail_Click);

    //            ApplicationBarIconButton cmdCamera = new ApplicationBarIconButton();
    //            cmdCamera.IconUri = new Uri("Images/camera.png", UriKind.Relative);
    //            cmdCamera.Text = "Camera";
    //            ApplicationBar.Buttons.Add(cmdCamera);

    //            ApplicationBarIconButton cmdCancel = new ApplicationBarIconButton();
    //            cmdCancel.IconUri = new Uri("Images/cancel.png", UriKind.Relative);
    //            cmdCancel.Text = "Cancel";
    //            ApplicationBar.Buttons.Add(cmdCancel);
    //            cmdCancel.Click += new EventHandler(cmdCancel_Click);
    //        }
    //    }

    //    void cmdsearch_Click(object sender, RoutedEventArgs e)
    //    {
    //        gribpopup.Visibility = Visibility.Visible;
    //    }

    //    void cmdMail_Click(object sender, EventArgs e)
    //    {
    //        Image img = new Image();
    //        img.Source = new BitmapImage(new Uri("Images/message1.png", UriKind.Relative));

    //        ImageBrush bg = new ImageBrush();
    //        bg.ImageSource = img.Source;

    //        //Stack chứa Background
    //        StackPanel stpbg = new StackPanel();
    //        stpbg.Background = bg;

    //        StackPanel stpChat = new StackPanel();
    //        stpChat.Orientation = System.Windows.Controls.Orientation.Vertical;

    //        TextBlock txbChat = new TextBlock();
    //        txtChat.TextWrapping = TextWrapping.Wrap;
    //        txbChat.Text = txtChat.Text.Trim();
    //        txbChat.TextWrapping = TextWrapping.Wrap;

    //        TextBlock txbTime = new TextBlock();

    //        int hour = tpk.Value.Value.Hour;
    //        int min = tpk.Value.Value.Minute;
    //        int sec = tpk.Value.Value.Second;
    //        txbTime.Text = hour.ToString() + ":" + min.ToString() + ":" + sec.ToString();

    //        txbChat.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
    //        txbTime.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;

    //        stpChat.Children.Add(txbChat);
    //        stpChat.Children.Add(txbTime);
    //        stpChat.Margin = new Thickness(30);
    //        stpbg.Children.Add(stpChat);

    //        stpbg.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;

    //        stpConversation.Children.Add(stpbg);
    //        txtChat.Text = "Type new messages...";
    //    }

    //    void cmdCancel_Click(object sender, EventArgs e)
    //    {
    //        pvMiniChat.SelectedItem = pvListContact;
    //    }

    //    void cmdSent_Click(object sender, EventArgs e)
    //    {
    //        Image img = new Image();
    //        img.Source = new BitmapImage(new Uri("Images/message.png", UriKind.Relative));

    //        ImageBrush bg = new ImageBrush();
    //        bg.ImageSource = img.Source;

    //        //Stack chứa Background
    //        StackPanel stpbg = new StackPanel();
    //        stpbg.Background = bg;

    //        StackPanel stpChat = new StackPanel();
    //        stpChat.Orientation = System.Windows.Controls.Orientation.Vertical;

    //        TextBlock txbChat = new TextBlock();
    //        txtChat.TextWrapping = TextWrapping.Wrap;
    //        txbChat.Text = txtChat.Text.Trim();
    //        txbChat.TextWrapping = TextWrapping.Wrap;

    //        TextBlock txbTime = new TextBlock();

    //        int hour = tpk.Value.Value.Hour;
    //        int min = tpk.Value.Value.Minute;
    //        int sec = tpk.Value.Value.Second;
    //        txbTime.Text = hour.ToString() + ":" + min.ToString() + ":" + sec.ToString();

    //        stpChat.Children.Add(txbChat);
    //        stpChat.Children.Add(txbTime);
    //        stpChat.Margin = new Thickness(30);

    //        stpbg.Children.Add(stpChat);

    //        stpbg.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    //        stpConversation.Children.Add(stpbg);
    //        txtChat.Text = "Type new messages...";
    //    }

    //    private void txtChat_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    //    {
    //        if (txtChat.Text == "Type new messages...")
    //            txtChat.Text = "";
    //    }


    
    }
}